-
Notifications
You must be signed in to change notification settings - Fork 34
IOT Config Gateway v2 #1072
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
IOT Config Gateway v2 #1072
Conversation
af6c6c3 to
770f289
Compare
fac8be3 to
06a07e0
Compare
06a07e0 to
abb42a9
Compare
| .signing_keypair() | ||
| .map(|keypair| keypair.public_key().to_string())?; | ||
| tracing::debug!("listening on {listen_addr}"); | ||
| tracing::debug!("signing as {pubkey}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bbalser Do we want take this opportunity to log the settings?
| let (tx, rx) = tokio::sync::mpsc::channel(20); | ||
|
|
||
| tokio::spawn(async move { | ||
| let epoch: DateTime<Utc> = "1970-01-01T00:00:00Z".parse().unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chrono provides a constant for the epoch.
DateTime::UNIX_EPOCH;
Also, DateTime::<Utc>::default() is UNIX_EPOCH. We could consider passing epoch as an Option<DateTime<Utc>> to stream_all_gateways_info and .unwrap_or_default() when it's empty if that's more readable.
I don't know we're gaining anything from this function being called in a tokio::select! with a single branch.
| .bind(min_last_changed_at) | ||
| .bind(min_location_changed_at) | ||
| .fetch(db) | ||
| .map_err(anyhow::Error::from) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we be .inspect_err() here so we're not silently ignoring potential errors?
| biased; | ||
| _ = &mut shutdown => break, | ||
| _ = interval.tick() => { | ||
| if let Err(err) = execute(&self.pool, &self.metadata).await { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't want to propagate this err and crash the service if it happens?
gateway/gateway/tracker